<template>
	<div>
		<form>

			<el-row>
				<el-col :span="10">
					<el-input v-model="query.registerId" placeholder="请输入病历号"></el-input>
				</el-col>

				<el-col :span="4">
					<el-button type="primary" @click="list">查询</el-button>
				</el-col>
			</el-row>
		</form>


       <el-tag style="width: 300px;margin-top: 20px;">已挂号患者信息</el-tag>
		<el-table :data="tableData" size="mini"  style="width: 100%">
		
		
			<el-table-column label="病历号"  prop="id">
			</el-table-column>
			
			<el-table-column label="患者名称" prop="name">
			</el-table-column>
			
			<el-table-column label="挂号的科室" prop="deptName">
			</el-table-column>
			
			<el-table-column label="号别" prop="levelName">
			</el-table-column>
			
			<el-table-column label="医生" prop="realname">
			</el-table-column>
			
			<el-table-column label="看诊时间" prop="visittime">
			</el-table-column>
			
			<el-table-column label="挂号状态" >
				<template slot-scope="scope">
					
					<el-tag v-if="scope.row.status == 1">已挂号</el-tag>
					<el-tag type="successss" v-else-if="scope.row.status == 2">已接诊</el-tag>
					<el-tag type="danger" v-else>已退号</el-tag>
		
				</template>
				
				
			</el-table-column>
			<el-table-column label="挂号时间" prop="createtime">
			</el-table-column>
				<el-table-column label="操作" >
					<template slot-scope="scope">
						<el-button size="mini" v-if="scope.row.status == 1" @click="unregist(scope.row.id)">退号</el-button>
					</template>
				</el-table-column>
		
		
		</el-table>

		
	</div>
</template>

<script>
	
	export default {
		name: 'UnRegist',
		components: {
			
		},
		data() {
			return {
				showNum: 0,
				total: 0,
				query: {
					pageSize: 10,
					pageNo: 1,
					registerId: ''
				},
				tableData: []
			}
		},
		methods: {
			list() {
			
				this.axios.get('/register?type=queryRegistListById',(data)=>{
					this.tableData = data
				},this.query)
			},
			currentChange() {
				this.list();
			},
			unregist(id){
				this.axios.get("/register?type=unregist",success=>{
					if(success){
						this.$message.success("退号成功");
						this.list();
					}else{
						this.$message.error("退号失败");
					}
				},
				{
					id:id
				})
			}
		},
		created() {
			//this.list();
		}
	}
</script>

<style>
</style>
